package com.itheima.pojo;

import com.fasterxml.jackson.annotation.JsonFormat;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;

/**
 * @Author：cxl
 * @Package：com.itheima.pojo
 * @Project：web-project
 * @name：Emp
 * @Date：2025-09-26 12:12 pm
 * @Filename：Emp
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Emp {
    private Integer id;
    @NotBlank(message = "用户名不能为空")
    @Size(min = 2, max = 20, message = "用户名长度必须在2-20之间")
    private String username;
    private String password;
    private String name;
    private Integer gender;
    @NotBlank(message = "手机号不能为空")
    //1.^以什么开头，$以什么结尾
    //^ : 匹配字符串的开始
    //1 : 第一位必须是数字1
    //[3-9] : 第二位必须是3到9之间的任意数字
    //\\d{8} : 后面跟着8个数字字符(\d表示数字，{8}表示重复8次)
    //$ : 匹配字符串的结束
    //@Pattern(regexp = "^1[3-9]\\d{8}$", message = "手机号码格式不正确，手机号码必须11位，是有效的手机号码")
    // 放宽手机号验证规则
    @Pattern(regexp = "^1\\d{10}$", message = "手机号码格式不正确")
    private String phone;
    private Integer job;
    private Integer salary;
    private String image;
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date entryDate;
    private Integer deptId;
    @JsonFormat(pattern = "yyyy-MM-dd' 'HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime createTime;
    @JsonFormat(pattern = "yyyy-MM-dd' 'HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime updateTime;
    //部门表的name,mapper里用left join查的
    private String deptName;
    private List<EmpExpr> exprList;
};
